package de.preamp.clients.java.utils.ui;

import java.awt.Font;
import java.awt.Frame;
import java.awt.GridLayout;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

import de.preamp.clients.java.utils.Tools;


/**
 * The "about-dialog" shown when help/about is clicked.
 * 
 * @author André Stannek
 * @version 2009-08-29
 */
public class AboutDialog extends JDialog
{

    /**
     * Generated UID.
     */
    private static final long serialVersionUID = 8180705294449715013L;

    /**
     * @param owner
     *            the owner of this dialog.
     */
    public AboutDialog(final Frame owner)
    {
        super(owner, true);
        this.setResizable(false);
        this.setModal(true);
        final int height = 600;
        final int width = 400;

        final JPanel content = new JPanel(new GridLayout(19, 1));

        final Font headline = new Font(null, Font.BOLD, 18);
        final Font sections = new Font(null, Font.ITALIC, 14);

        final JLabel headClient = new JLabel("preamp client", JLabel.CENTER);
        headClient.setFont(headline);
        final JLabel written1 = new JLabel("written by:", JLabel.LEFT);
        written1.setFont(sections);
        final JLabel written2 = new JLabel("written by:", JLabel.LEFT);
        written2.setFont(sections);
        final JLabel usage1 = new JLabel("with use of:", JLabel.LEFT);
        usage1.setFont(sections);
        final JLabel usage2 = new JLabel("with use of:", JLabel.LEFT);
        usage2.setFont(sections);
        final JLabel support1 = new JLabel("with support of:", JLabel.LEFT);
        support1.setFont(sections);

        content.add(headClient);
        content.add(written1);
        content.add(new JLabel("André Stannek", JLabel.CENTER));
        content.add(support1);
        content.add(new JLabel("Oliver Bestmann", JLabel.CENTER));
        content.add(usage1);
        content.add(new JLabel("http://www.json.org/java/index.html",
                JLabel.CENTER));
        content.add(new JLabel("http://www.javazoom.net/mp3spi/mp3spi.html",
                JLabel.CENTER));
        content.add(new JLabel("last.fm API bindings by roar-software",
                JLabel.CENTER));

        content.add(new JLabel(""));
        final JLabel headServer = new JLabel("preamp server", JLabel.CENTER);
        headServer.setFont(headline);
        content.add(headServer);
        content.add(written2);
        content.add(new JLabel("André Stannek", JLabel.CENTER));
        content.add(new JLabel("Dennis Keitzel", JLabel.CENTER));
        content.add(usage2);
        content.add(new JLabel("http://code.google.com/p/mutagen/",
                JLabel.CENTER));

        content.add(new JLabel(""));
        content.add(new JLabel("this project stands under the GPLv3",
                JLabel.CENTER));
        content.add(new JLabel("http://code.google.com/p/preamp/",
                JLabel.CENTER));

        this.setContentPane(content);

        // Handle window closing correctly.
        this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

        this.setBounds(Tools.getCenteredBounds(width, height));
        this.setVisible(true);
    }

}
